package cn.zorbus.jackson;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
import jakarta.annotation.PostConstruct;
import lombok.RequiredArgsConstructor;
import org.springframework.context.annotation.Configuration;

/**
 * create in 2023/7/24 17:32
 *
 * @author shishaodong
 * @version 0.0.1
 */
@Configuration
@RequiredArgsConstructor
public class ObjectMapperConfig {

    private final ObjectMapper objectMapper;

    /**
     * jackson 注册 JavaTimeModule ,可以支持 LocalDateTime
     */
    @PostConstruct
    public void init() {
        objectMapper.registerModule(new JavaTimeModule());
    }
}